﻿@model ProductDetailsModel
@using Nop.Web.Models.Catalog;

@{
    //register CSS and JS files for file uploader button
    <link href="@Url.Content("~/Content/fileuploader/fileuploader.css")" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="@Url.Content("~/Scripts/fileuploader.js")"></script>
    
    var defaultProductVariant = Model.ProductVariantModels.Count > 0 ? Model.ProductVariantModels[0] : null;
}

<div class="product-details-page">
    @using (Html.BeginRouteForm("Product", new { productId = Model.Id, SeName = Model.SeName }, FormMethod.Post))
    {
        <div class="product-essential">
            <div class="product-details-info">
                <!--product pictures-->
                <div class="picture">
                    <img alt="@defaultProductVariant.PictureModel.AlternateText" src="@defaultProductVariant.PictureModel.ImageUrl" title="@defaultProductVariant.PictureModel.Title" style="border-width: 0px;" />
                </div>
                <div class="overview">
                    <h1 class="productname">
                        @Model.Name
                    </h1>
                    <div class="shortdescription">
                        @Html.Raw(Model.ShortDescription)
                    </div>
                    <div class="clear">
                    </div>
                    @{
        var dataDictPrice = new ViewDataDictionary();
        dataDictPrice.TemplateInfo.HtmlFieldPrefix = string.Format("price_{0}", defaultProductVariant.Id);
                        @Html.Partial("_ProductVariantPrice", defaultProductVariant.ProductVariantPrice, dataDictPrice)
                            
        var dataDictAddToCart = new ViewDataDictionary();
        dataDictAddToCart.Add("ProductId", Model.Id);
        dataDictAddToCart.TemplateInfo.HtmlFieldPrefix = string.Format("addtocart_{0}", defaultProductVariant.Id);
                        @Html.Partial("MiniProductDetailsViewProductVariantAddToCart", defaultProductVariant.AddToCart, dataDictAddToCart)                    
                    }
                    <div class="clear">
                    </div>
                    <span class="message-error">
                    </span>

                    @*@if (errors.Count > 0)
                    {
                        //display errors   
                        <span class="message-error">
                            @for (int i = 0; i < errors.Count; i++)
                            {
                                @errors[i]
                                if (i != errors.Count - 1)
                                {
                                    <br />
                                }
                            }
                        </span>
                        <div class="clear">
                        </div>
                    }
                    <br />*@
                </div>
            </div>
        </div>
        <div class="clear">
        </div>
        <div class="product-collateral">
            <div class="product-variant-line">
                <!--product tier prices-->
                @Html.Action("ProductTierPrices", "Catalog", new { productVariantId = defaultProductVariant.Id })
                <div class="clear">
                </div>
                @{
        var dataDictAttributes = new ViewDataDictionary { TemplateInfo = { HtmlFieldPrefix = string.Format("attributes_{0}", defaultProductVariant.Id) } };
                    @Html.Partial("_ProductAttributes", defaultProductVariant.ProductVariantAttributes, dataDictAttributes)                  
                }
                <div class="clear">
                </div>
                @{
        var dataDictGiftCard = new ViewDataDictionary { TemplateInfo = { HtmlFieldPrefix = string.Format("giftcard_{0}", defaultProductVariant.Id) } };
                    @Html.Partial("_GiftCardInfo", defaultProductVariant.GiftCard, dataDictGiftCard)
                }
            </div>
        </div>
    }
</div>
